import 'package:get/get.dart';
import 'package:safetymonitor/app/core/http/http.dart';
import 'package:safetymonitor/app/core/utils/interface.dart';
import 'package:safetymonitor/app/data/entities/home/warning/alarm_resp_entity.dart';
///详情
class AlarmDetailController extends GetxController {
  /// 实体数据
  AlarmRespEntity entity = Get.arguments as AlarmRespEntity;

  @override
  void onInit() {
    super.onInit();
    getDetailsData();
  }

  /// 获取详情数据
  void getDetailsData() async {
    final res = await HttpUtil().generateGetRequest<AlarmRespEntity>(
      Interface.getAlarmDetailPage,
      queryParameters: {'id': entity.id},
    ).execute();
    res.onSuccess((result) {
      if (result.data != null) {
        entity = result.data!;
      }
      update();
    });
  }
}

